<template>
	<div class="flex_Column">
		<!-- 外框 -->
		<div class="content" v-for="(item, index) in TopList.datas" :key="index" @click="JumpFoodsDetail(item)">
			<!-- 左边图框 -->
			<div class="leftimage">
				<div class="Top_Box" :style="{ 'background-color': TopColor[index] }">
					<p>TOP·{{ index + 1 }}</p>
				</div>

				<img :src="getImages(item.smallImg)" alt="" />
			</div>
			<!-- 右边文字 -->
			<div class="foodsright">
				<h4>{{ item.cpName }}</h4>
				<p>{{ item.type }}</p>
				<div class="graphic">
					<img src="@/assets/images/今日推荐.jpg" alt="" />
					<span>用户名称 </span>
				</div>
				<p>{{ item.ct.substring(0, item.ct.lastIndexOf('-') + 3) }}</p>
				<div class="thumbsup">
					<p><span>100</span>人点赞</p>
					<p>浏览<span>100</span>次</p>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
import { getMenuDetail } from '@/api/menu';
export default {
	name: 'FoodsListContent',
	data() {
		return {
			TopList: [],
			TopColor: ['red', 'orangered', 'gold'],
		};
	},
	async created() {
		this.TopList = await getMenuDetail({
			type: '热门专题',
			maxResults: 10,
		});
	},
};
</script>

<style scoped>
* {
	margin: 0;
	padding: 0;
}
.flex_Column {
	flex-direction: column;
	padding: 20px;
}
.content {
	width: 100%;
	display: flex;
	margin-bottom: 20px;
}
.leftimage {
	position: relative;
	width: 50%;
	overflow: hidden;
	border-radius: 10px;
	min-width: 165px;
}
.leftimage img {
	width: 100%;
	height: 100%;
	border-radius: 10px;
}
.leftimage .Top_Box {
	position: absolute;
	top: 0;
	left: 0;
	width: 40%;
	height: 20%;
	border-radius: 0 0 10px 0;
	background-color: black;
}
.leftimage .Top_Box p {
	color: #fff;
	font-size: 14px;
	text-align: center;
}

.foodsright {
	width: 50%;
	position: relative;
	margin-left: 10px;
}
.foodsright > h4 {
	display: block;
	width: 180px;
	text-overflow: ellipsis;
	white-space: nowrap;
	overflow: hidden;
}
.foodsright > p {
	font-size: 10px;
	display: block;
	width: 180px;
	text-overflow: ellipsis;
	white-space: nowrap;
	overflow: hidden;
	color: #aaa;
}

.graphic {
	display: flex;
	margin: 5px 0;
}
.graphic span {
	font-size: 12px;
	margin-left: 5px;
}
.graphic > img {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background-color: red;
	vertical-align: middle;
}
.graphic > p {
	margin-left: 25px;
}
.thumbsup {
	display: flex;
}
.thumbsup p {
	font-size: 10px;
	display: block;
	text-overflow: ellipsis;
	white-space: nowrap;
	overflow: hidden;
}
.thumbsup p span {
	color: orangered;
	font-weight: 500;
}
.thumbsup :first-child {
	flex: 2;
}
.thumbsup:last-child {
	flex: 1;
}
</style>
